# 正则表达式
import re
# 检测字符串是否有hello
result = re.match('hello', 'hello world')
print(result)  # re.Match object; span=(0, 5), match='hello'>
# 检测字符串是否有数字
result = re.match(r'\d', '1234443')
print(result)  # <re.Match object; span=(0, 1), match='1'>
# 检测字符串是否为纯数字
result = re.match(r'\d+', '1234443')
print(result)  # <re.Match object; span=(0, 7), match='1234443'>
# \s 空白字符  \S 非空白字符
result = re.match(r'\s', ' ')
print(result)  # <re.Match object; span=(0, 1), match=' '>
# $ 字符串结尾
result = re.match(r'^\s+$', '   ')
print(result)  # <re.Match object; span=(0, 1), match=' '>

print('*******************')

# 身份证号验证
from my_package import my_regular_expression
print(my_regular_expression.verify_id_number('12345619980115530X'))
# result = re.match(r'^\d{6}((19\d\d)|(20[012][012345]))(0[123456789]|1[012])(0[123456789]|1[0123456789]|2[0123456789]|3[01])\d{3}([\dX])$', '12345619980115530X')
# print(result)
